<!--<h4>{{helper:lang line = 'salary:salary'}} {{year}}</h4>-->
<?php echo form_open('','class="form_input"')?>
<h3 class="title" style="margin-top:10px">{{title}} {{helper:lang line='global:month'}} {{month}} / <?php echo $year ?></h3>
<table class="tbl">

<thead>
	<tr>
		<th class="tc" style="width:5%">{{helper:lang line='global:stt'}}</th>
		<th style="width:35%;">{{helper:lang line='users:full_name'}}</th>
		<th style="width:20%" >{{helper:lang line='salary:{{method}}_single'}}</th>
		<th style="width:35%">{{helper:lang line='global:note'}}</th>
		<th style="width:5%"><a title="{{helper:lang line='global:save'}}" class="save-pm">{{theme:image file = '_icon/admin/icon-32-save.png' }}</a></th>
	</tr>
</thead>
{{model}}
	<tr>
		<td class="tc">{{helper:count identifier}}</td>
		<td class="upc"><span title="{{ profile:display_name }}" class="tooltip">{{ profile:display_name }}</span>
			<div class="info" style="display:none">
				{{helper:lang line='users:phone'}} : {{profile:phone}}
			</div>
		</td>
		{{if method == 'plus'}}
		<td><input class="txt large" type="text" name="value[{{user_id}}]" value="{{helper:number value = plus}}" /></td>
		<td colspan="2"><textarea class="txt large" name="note[{{user_id}}]" rows="1" data="{{user_id}}">{{plus_note}}</textarea></td>
		{{endif}}
		{{if method == 'minus'}}
		<td><input class="txt large" type="text" name="value[{{user_id}}]" data="{{user_id}}" value="{{helper:number value = minus}}" /></td>
		<td colspan="2"><textarea class="txt large" name="note[{{user_id}}]" rows="1" data="{{user_id}}" >{{minus_note}}</textarea></td>
		{{endif}}
		{{if method == 'factor'}}
		<td><input class="txt" style="width:30px" type="text" name="value[{{user_id}}]" data="{{user_id}}" value="{{factor}}" /></td>
		<td colspan="2"><textarea class="txt large" name="note[{{user_id}}]" rows="1" data="{{user_id}}" >{{factor_note}}</textarea></td>
		{{endif}}
	</tr>
{{/model}}
</table>
<?php echo form_close()?>
{{if ! model }}
    	<p>{{helper:lang line='global:nodata'}}</p>
{{endif}}

<script>

$('.tooltip').tooltip({
	//items:'.info',
    content: function () {
		//alert($(this).siblings('.info'));
		return $(this).siblings('.info').html();//.prop('title');
	}
});
$('.save-pm').tooltip({
	//items:'.info',
    content: function () {
		//alert($(this).siblings('.info'));
		return $(this).prop('title');
	}
});

$('.txt').bind("keypress",function(){
	$(this).parent().parent().addClass('updating');
});

$('a.save-pm').click(function(){
	$remove = $('.form_input tr').not('.updating').find('input,textarea').removeAttr('name');
	$data = $('.form_input').serialize();
	$method = '{{method}}';
	$.ajax({
		url:'{{url:site uri="emp_profile/salary/update_plus_minus/{{method}}"}}/{{year}}/{{month}}',
		data:$data,
		type:'post',
		success:function(){
			location.reload();
		}
	});
});
</script>